While nb-mermaid will work with any Jupyter kernel, IPython provides a way to capture loading an extension directly in a cell as a %linemagic:
In [4]:
%reload_ext mermaid
If you take a look at the ipynb source, you'll see this embeds a tiny bit of javascript that will first try to hit your server's nbextensions directory, but failing that will fall back to the nb-mermaid github repository. This means you can use it to publish on nbviewer.jupyter.org.